<?php

namespace common\jobs;

use Yii;
use yii\base\Exception;
use common\jobs\base\BaseJob;
use common\jobs\handle\OrderRefundHandle;

/**
 * 订单自动退款处理
 * Class OrderRefundJob.
 */
class OrderRefundJob extends BaseJob {

    /**
     * @var integer 退款ID
     */
    public $refund_id = null;

    /**
     * @param \yii\queue\Queue $queue
     */
    public function execute($queue) {
        if ($this->refund_id == null) {
            throw new Exception('refund_id is null!');
        }
        $model = new OrderRefundHandle();
        $model->refund_id = $this->refund_id;
        $model->job = $this;
        return $model->submit();
    }

}
